/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package imp.base;

import interfaces.base.BaseInt;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;

/**
 *
 * @author eisa
 */
public class BaseImp implements BaseInt {


    public Object add(Object object) {
        SessionFactory seeFactory=new Configuration().configure("config/Hibernate/hibernate.cfg.xml").buildSessionFactory();
        Session session=seeFactory.openSession();
        
        try
        {
        session.beginTransaction();
        session.persist(object);
        session.getTransaction().commit();
        }
        catch(Exception ex)
        {
            ex.printStackTrace();
        }
        return object;
    }

    public boolean remove(Object o) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public Object update(Object object) {
        throw new UnsupportedOperationException("Not supported yet.");
    }

}
